package com.codi.bus.core.resultModel;

import com.alibaba.fastjson.annotation.JSONField;
import com.codi.base.util.DateUtils;
import com.codi.base.util.MoneyUtils;
import com.codi.bus.core.service.model.AssetFundModel;
import lombok.Getter;
import lombok.Setter;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * 零钱包详情
 */
public class WalletDetailResultV2 extends BaseResult {

    private static final long serialVersionUID = 1L;

    /**
     * 当日收益
     */
    private BigDecimal tti;
    private String totalTodayIncome;

    /**
     * 总资产
     */
    private BigDecimal twv;
    private String totalWorthValue;

    /**
     * 累计收益
     */
    private BigDecimal ti;
    private String totalIncome;

    /**
     * 总在途金额
     */
    @Getter
    @Setter
    private BigDecimal inTransitAmount;

    public String getInTransitAmountString(){
        if (inTransitAmount != null && inTransitAmount.doubleValue() != 0.00 ) {
            StringBuffer sb = new StringBuffer();
            sb.append("买入待确认");
            sb.append(MoneyUtils.formatMoney(inTransitAmount));
            return sb.toString();
        }
        return "";
    }


    /**
     * 在途笔数
     */
    @Getter
    @Setter
    private Integer inTransitNum;

    public String getInTransitNumString() {
        if (inTransitNum != null && inTransitNum != 0) {
            StringBuffer sb = new StringBuffer();
            sb.append("有");
            sb.append(inTransitNum);
            sb.append("笔买入确认中");
            return sb.toString();
        }
        return "";
    }

    /**
     * 净值日期
     */
    private Date netValueDate;

    @JSONField(serialize = false)
    public Date getNetValueDate() {
        return this.netValueDate;
    }

    public void setNetValueDate(Date netValueDate) {
        this.netValueDate = netValueDate;
    }

    // 净值日期字符串 MM-dd
    public String getNetValueDateString() {
        if (this.netValueDate != null) {
            return DateUtils.formatDate7(this.netValueDate);
        } else {
            return "";
        }
    }



    /**
     * 持有基金
     */
    private List<AssetFundModel> fundModelList;

    public String getTotalTodayIncome() {
        return totalTodayIncome == null ? "0.00" : totalTodayIncome;
    }

    public void setTotalTodayIncome(String totalTodayIncome) {
        this.totalTodayIncome = totalTodayIncome;
    }

    public String getTotalWorthValue() {
        return totalWorthValue == null ? "0.00" : totalWorthValue;
    }

    public void setTotalWorthValue(String totalWorthValue) {
        this.totalWorthValue = totalWorthValue;
    }

    public String getTotalIncome() {
        return totalIncome == null ? "0.00" : totalIncome;
    }

    public void setTotalIncome(String totalIncome) {
        this.totalIncome = totalIncome;
    }

    public List<AssetFundModel> getFundModelList() {
        return fundModelList;
    }

    public void setFundModelList(List<AssetFundModel> fundModelList) {
        this.fundModelList = fundModelList;
    }

    public BigDecimal getTti() {
        return tti;
    }

    public void setTti(BigDecimal tti) {
        this.tti = tti;
    }

    public BigDecimal getTwv() {
        return twv;
    }

    public void setTwv(BigDecimal twv) {
        this.twv = twv;
    }

    public BigDecimal getTi() {
        return ti;
    }

    public void setTi(BigDecimal ti) {
        this.ti = ti;
    }
}
